<template>
  <div>模板ref</div>
  <h1 ref="count">1234</h1>
  <hr />
  <Child ref="count1" />
</template>

<script>
import Child from '@/components/child'
import { onMounted, ref } from 'vue'
export default {
  components: {
    Child
  },
  setup () {
    // 定义变量
    const count = ref()
    onMounted(() => {
      console.log('vue3获取dom对象', count, count.value)
      count.value.style.color = 'red'
      console.log('vue3获取组件对象', count, count1.value)
      count1.value.fn()
    })
    const count1 = ref()
    return { count, count1 }
  }
}
</script>

<style lang="scss" scoped>
</style>
